package cn.tedu.controller;

import cn.tedu.pojo.HouseResources;
import cn.tedu.service.HouseResourcesService;
import cn.tedu.vo.PageResult;
import cn.tedu.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author:努力学java的小雨
 * @创建时间:2021/9/27 17:21
 */
@RestController
@CrossOrigin
@RequestMapping("/houseResources")
public class HouseResourcesController {
    @Autowired
    private HouseResourcesService houseResourcesService;
    @GetMapping("/findAll")
    public SysResult houseResourcesFindAll(PageResult pageResult){
        pageResult=houseResourcesService.houseResourcesFindAll(pageResult);
        return SysResult.success(pageResult);
    }
    @PutMapping("/updateStatus")
    public SysResult updateStatus(@RequestBody HouseResources houseResources){
        houseResourcesService.updateStatus(houseResources);
        return SysResult.success();
    }
    @GetMapping("/findStatus")
    public SysResult findStatus(Integer id){
        HouseResources houseResources=houseResourcesService.findStatus(id);
        return SysResult.success(houseResources);
    }
    @GetMapping("/findHouse")
    public SysResult findHouse(Integer id){
        HouseResources houseResources=houseResourcesService.findHouse(id);
        return SysResult.success(houseResources);
    }
    @PutMapping("/updateHouseResource")
    public SysResult updateHouseResource(@RequestBody HouseResources houseResources){
        houseResourcesService.updateHouseResource(houseResources);
        return SysResult.success();
    }

}
